from math import ceil
from typing import List


class Solution:
    def minSpeedOnTime(self, dist: List[int], hour: float) -> int:
        left, right = 1, 10 ** 7 + 1
        while left < right:
            mid = (left + right) // 2

            time = 0
            for d in dist:
                time = ceil(time)
                time += d / mid

            # print(mid, ":", time)

            # 速度快了
            if time <= hour:
                right = mid

            # 速度慢了
            elif time > hour:
                left = mid + 1

        return left if left < 10 ** 7 + 1 else -1


if __name__ == "__main__":
    print(Solution().minSpeedOnTime(dist=[1, 3, 2], hour=6))  # 1
    print(Solution().minSpeedOnTime(dist=[1, 3, 2], hour=2.7))  # 3
    print(Solution().minSpeedOnTime(dist=[1, 3, 2], hour=1.9))  # -1
